package com.boot.study.demo.controller;

import com.boot.study.common.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author liwei
 * @date 2022/3/15
 **/
@RestController
@RequestMapping("demo")
public class DemoController {

    @Autowired
    private DemoService demoService;

    /**
     * post 请求传值， json
     */
    @PostMapping("01")
    public Result<DemoResponse> demo01(@RequestBody DemoRequest demoRequest){
      return Result.success(demoService.demo01(demoRequest));
    }

    /**
     * get请求传值    demo/02?name=xxx
     * @return
     */
    @GetMapping("02")
    public Result<DemoResponse> demo02(@RequestParam String name){
        return Result.success(demoService.demo02(name));
    }
}
